In [17]:
d = {'k1':1,'k2':2}
In [12]:
{x:x**2 for x in range(10)}
Out[12]:
One of the reasons it is not as common is the difficulty in structuring the key names that are not based off the values.
In [14]:
for k in d.iterkeys():
print k
In [15]:
for v in d.itervalues():
print v
In [16]:
for item in d.iteritems():
print item
In [2]:
d.viewitems()
Out[2]:
In [5]:
d.viewkeys()
Out[5]:
In [18]:
d.viewvalues()
Out[18]:
Great! You should now feel very comfortable using the variety of methods available to you in Dictionaries!